package control.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import control.mapper.authmanage.UserRoleMapper;
import control.module.po.authmanage.UserRole;
import control.service.IUserRoleService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户角色表 服务实现类
 * </p>
 *
 * @author cyj
 * @since 2020-10-21
 */
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements IUserRoleService {

    @Override
    public boolean removeByUserId(Integer userId) {
        return remove(new QueryWrapper<>(new UserRole().setUserId(userId)));
    }

    @Override
    public List<UserRole> getByUserId(Integer userId) {
        return this.baseMapper.selectList(new QueryWrapper<>(new UserRole().setUserId(userId)));
    }
}
